<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.java.service.*,java.util.*,com.java.model.UserSession,com.java.util.*,java.text.DecimalFormat;
    "%>    
<jsp:include page="common/header.jsp"></jsp:include>
<%
	UserSession usersession = (UserSession)session.getAttribute("user");
	String ent_id 			= (String)session.getAttribute("ent_id");
	
	String connGroup 	= "";
	String user_id 		= "";
	if(usersession!=null){
		connGroup 	= CmmUtil.nvl(usersession.getConnGroup(),"0");
		user_id 	= CmmUtil.nvl(usersession.getUser_id(),"");
	}
	
	Calendar now = Calendar.getInstance();
	String year     = String.valueOf(now.get(Calendar.YEAR));
	String month    = String.valueOf(now.get(Calendar.MONTH)+1);
	String curDay   = String.valueOf(now.get(Calendar.DATE));
	
	if(month.length() == 1){
		month = 0 + month;
	}
	
	if(curDay.length() == 1){
		curDay = 0 + curDay;
	}

	now.add(Calendar.MONTH,-1);
	
	String b_year     = String.valueOf(now.get(Calendar.YEAR));
	String b_month    = String.valueOf(now.get(Calendar.MONTH)+1);
	String b_curDay   = String.valueOf(now.get(Calendar.DATE));
	
	if(b_month.length() == 1){
		b_month = 0 + b_month;
	}
	
	if(b_curDay.length() == 1){
		b_curDay = 0 + b_curDay;
	}
	
	String start_dt = CmmUtil.nvl(request.getParameter("start_dt"),b_year + b_month + b_curDay);
	String close_dt = CmmUtil.nvl(request.getParameter("close_dt"),year + month + curDay);
	
	/*
	String present_Year = String.valueOf(GregorianCalendar.getInstance().get(Calendar.YEAR));
	//GregorianCalendar에서 1월 return 값이 0이므로 Month에는  1을 더해주어야 함
	String present_Month = String.valueOf(GregorianCalendar.getInstance().get(Calendar.MONTH)+1); 
	String present_Date 	= String.valueOf(GregorianCalendar.getInstance().get(Calendar.DATE));
	
	if(present_Month.length() == 1){
		present_Month = "0" + present_Month; //01월,02월 ..... 09월
	}
	
	GregorianCalendar g = new GregorianCalendar();
	g.add(Calendar.MONTH, 0);
	
	String befor_Month = String.valueOf(g.get(Calendar.MONTH));
	
	if(befor_Month.length() == 1){
		befor_Month = "0" + befor_Month; //01월,02월 ..... 09월
	}
	
	if(present_Date.length() == 1){
		present_Date = "0" + present_Date; //01일,02일 ..... 09일
	}
	
	String start_dt = CmmUtil.nvl(request.getParameter("start_dt"),present_Year + befor_Month + present_Date);
	String close_dt = CmmUtil.nvl(request.getParameter("close_dt"),present_Year + present_Month + present_Date);
	*/
	 	
	HashMap map = new HashMap();
	HashMap map1 = null;
	HashMap map2 = null;
	
	
	ArrayList list = new ArrayList();
	ArrayList list1 = new ArrayList();
	ArrayList list2 = new ArrayList();
	
	CommonDaoService commonservice = new CommonDaoService("Com0101lp02Dao");
	
	map.put("ent_id",ent_id);
	map.put("start_dt",start_dt);
	map.put("close_dt",close_dt);
	map.put("user_id",user_id);
	
	
	list = (ArrayList)commonservice.commonDaoMethod(map);
	
	String kisu_app_cnt ="";
	String kisu_noapp_cnt ="";
	String kisu_cancel_cnt ="";
	String sang_app_cnt ="";
	String sang_noapp_cnt ="";
	String sang_cancel_cnt ="";
	String lect_amt_kisu ="";
	String lect_amt_sang ="";
	String ret_amt_kisu ="";
	
	String poi_cnt ="";
	String kisu_member_cnt ="";
	String sang_member_cnt ="";
	String kisu_poi_cnt ="";
	String sang_poi_cnt ="";
	String lect_amt_kisu_sugang ="";
	String lect_amt_sang_sugang ="";
	String ret_amt_kisu_sugang ="";
	
	if(list != null){
		if(list.size() > 0){
			list1 = (ArrayList)list.get(0);
			
			kisu_app_cnt = (String)((HashMap)list1.get(0)).get("kisu_app_cnt");
			kisu_noapp_cnt = (String)((HashMap)list1.get(0)).get("kisu_noapp_cnt");
			kisu_cancel_cnt = (String)((HashMap)list1.get(0)).get("kisu_cancel_cnt");
			sang_app_cnt = (String)((HashMap)list1.get(0)).get("sang_app_cnt");
			sang_noapp_cnt = (String)((HashMap)list1.get(0)).get("sang_noapp_cnt");
			sang_cancel_cnt = (String)((HashMap)list1.get(0)).get("sang_cancel_cnt");
			lect_amt_kisu = (String)((HashMap)list1.get(0)).get("lect_amt_kisu");
			lect_amt_sang = (String)((HashMap)list1.get(0)).get("lect_amt_sang");
			ret_amt_kisu = (String)((HashMap)list1.get(0)).get("ret_amt_kisu");
		}
		if(list.size() > 1){
			list2 = (ArrayList)list.get(1);
			
			poi_cnt = CmmUtil.nvl((String)((HashMap)list2.get(0)).get("poi_cnt"),"0");
			kisu_member_cnt = (String)((HashMap)list2.get(0)).get("kisu_member_cnt");
			sang_member_cnt = (String)((HashMap)list2.get(0)).get("sang_member_cnt");
			kisu_poi_cnt = CmmUtil.nvl((String)((HashMap)list2.get(0)).get("kisu_poi_cnt"),"0");
			sang_poi_cnt = CmmUtil.nvl((String)((HashMap)list2.get(0)).get("sang_poi_cnt"),"0");
			lect_amt_kisu_sugang = (String)((HashMap)list2.get(0)).get("lect_amt_kisu");
			lect_amt_sang_sugang = (String)((HashMap)list2.get(0)).get("lect_amt_sang");
			ret_amt_kisu_sugang = (String)((HashMap)list2.get(0)).get("ret_amt_kisu");
		}		
	}
	
	
	
%>
<body>
<table width="992" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td>
    <!--top -->
	<jsp:include page="common/top_menu.jsp"></jsp:include> 
    <!-- //top -->
    <!-- contents area -->
    <table width="850" border="0" cellpadding="0" cellspacing="0" align="center" >
    	<tr>
       	  <td width="550" align="left" style="padding:0 0 20px 10px;">
          	<table border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td ><img src="/images/hrd_icon1.gif"  alt="" border="0" /></td>
                  <td class="main_style1">학습보고 :</td>
                  <td width="400"><a href="/jsp/com0203l_p01.jsp"><img src="/images/hrd_main_BTN1.gif"  alt="" border="0" style="padding:0 0 0 5px;" /></a><a href="/jsp/com0204l_p01.jsp"><img src="/images/hrd_main_BTN2.gif"  alt="" border="0" style="padding:0 0 0 5px;" /></a><a href="/jsp/com0205l_p01.jsp"><img src="/images/hrd_main_BTN3.gif"  alt="" border="0" style="padding:0 0 0 5px;" /></a></td>
                </tr>
                <tr>
                  <td colspan="3" align="left"><img src="/images/line_dotted.gif"  alt="" border="0" /></td>
                </tr>
                <tr>
                  <td><img src="/images/hrd_icon1.gif"  alt="" border="0" /></td>
                  <td class="main_style1">정산보고 :</td>
                  <td width="400"><a href="/jsp/com0201l_p01.jsp"><img src="/images/hrd_main_BTN4.gif"  alt="" border="0" style="padding:0 0 0 5px;" /></a></td>
                </tr>
                <tr>
                  <td colspan="3" align="left"><img src="/images/line_dotted.gif"  alt="" border="0" /></td>
                </tr>
                <tr>
                  <td><img src="/images/hrd_icon1.gif"  alt="" border="0" /></td>
                  <td class="main_style1">환급보고 :</td>
                  <td width="400"><a href="/jsp/com0203l_p01.jsp"><img src="/images/hrd_main_BTN5.gif"  alt="" border="0" style="padding:0 0 0 5px;" /></a><a href="/jsp/com0202l_p01.jsp"><img src="/images/hrd_main_BTN6.gif"  alt="" border="0" style="padding:0 0 0 5px;" /></a></td>
                </tr>
          	</table>
          	</td>
            <td width="300" align="left" style="padding:0 0 20px 0">
            	<table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td align="left"><img src="/images/hrd_icon3.jpg"  alt="" border="0"></td>
                        <td width="280" class="main_style2" align="left">매뉴얼 다운로드</td>
                    </tr>
                     <tr>
                        <td colspan="2">
                        	<table width="297" height="124" border="0" cellpadding="0" cellspacing="0" background="images/manual_downloadBG.gif" align="left" style="margin:3px 0 0 0;">
                            	<tr>
                                	<td align="center" style="padding:13px 0 0 0"><a href="/file_down/study_guide.ppt" target="_blank"><img src="/images/hrd_main_BTN7.gif"  alt="" border="0"></a></td>
                                </tr>
                                <!-- tr>
                                	<td align="center" style="padding:0 0 10px 0"><a href="#"><img src="/images/hrd_main_BTN8.gif"  alt="" border="0" /></a></td>
                              </tr -->
                            </table>
                       </td>
                    </tr>
              </table>
            </td>	
        </tr>
    </table>
   	<table border="0" cellpadding="0" cellspacing="0" align="center">
    	<tr>
        	<td width="992" height="4" bgcolor="#c8c8c8"></td>
        </tr>
    </table>
	<table width="850" border="0" cellpadding="0" cellspacing="0" align="center">
    	<tr>
        	<td class="main_style1" style="padding:20px 0 0 0;" align="right"><img src="/images/hrd_icon1.gif"  alt="" border="0" style="padding:0 0 0 7px;"/>&nbsp;조회 기간 : <%=start_dt %> ~ <%=close_dt %></td>
        </tr>
	</table>
    <table width="850" border="0" cellpadding="0" cellspacing="0" align="center">
    	<tr>
        	<td class="main_style1" style="padding:20px 0 0 0;" align="left"><img src="/images/hrd_icon2.gif"  alt="" border="0" style="padding:0 0 0 7px;"/>&nbsp;수강신청 현황</td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" class="main_table1">
                  <tr>
                    <td colspan="5" class="table_th">기수 과정</td>
                    <td colspan="4" class="table_th">상시 과정</td>
                  </tr>
                  <tr>
                    <td class="table_td2Line">승인</td>
                    <td class="table_td2Line">미승인</td>
                    <td class="table_td2Line">취소</td>
                    <td class="table_td2Line">수강료</td>
                    <td class="table_td2Line">환급금</td>
                    <td class="table_td2Line">승인</td>
                    <td class="table_td2Line">미승인</td>
                    <td class="table_td2Line">취소</td>
                    <td class="table_td2Line">수강료</td>
                  </tr>
                  <tr>
                    
                    <td><%=kisu_app_cnt %></td>
                    <td><%=kisu_noapp_cnt %></td>
                    <td><%=kisu_cancel_cnt %></td>
                    <td><%=lect_amt_kisu %></td>
                    <td><%=ret_amt_kisu %></td>
                    <td><%=sang_app_cnt %></td>
                    <td><%=sang_noapp_cnt %></td>
                    <td><%=sang_cancel_cnt %></td>
                    <td><%=lect_amt_sang %></td>
                  </tr>
                </table>            
			</td>
        </tr>
        <tr>
        	<td class="main_style1" style="padding:4px 0 0 0;" align="left"><img src="/images/hrd_icon2.gif"  alt="" border="0" style="padding:0 0 0 7px;"/>&nbsp;수강 현황</td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" class="main_table1">
                  <tr>                    
                    <td rowspan="2" class="table_th">수강과정</td>
                    <td colspan="4" class="table_th">기수 과정</td>
                    <td colspan="3" class="table_th">상시 과정</td>
                  </tr>
                  <tr>
                    <td class="table_td2Line">과정수</td>
                    <td class="table_td2Line">학습자</td>
                    <td class="table_td2Line">수강료</td>
                    <td class="table_td2Line">환급금액</td>
                    <td class="table_td2Line">과정수</td>
                    <td class="table_td2Line">학습자</td>
                    <td class="table_td2Line">수강료</td>
                  </tr>
                  <tr>                    
                    <td><%=poi_cnt %></td>
                    <td><%=kisu_poi_cnt %></td>
                    <td><%=kisu_member_cnt %></td>
                    <td><%=lect_amt_kisu %></td>
                    <td><%=ret_amt_kisu %></td>
                    <td><%=sang_poi_cnt %></td>
                    <td><%=sang_member_cnt %></td>
                    <td><%=lect_amt_sang %></td>
                  </tr>
                </table>            </td>
        </tr>
        <tr>
        	<td class="main_style1" style="padding:4px 0 0 0;" align="left"><img src="/images/hrd_icon2.gif"  alt="" border="0" style="padding:0 0 0 7px;"/>&nbsp;학습현황</td>
        </tr>
        <tr>
        	<td width="100%">
            	<iframe name='stu_state' src="/jsp/ifm/stu_state.jsp?start_dt=<%=start_dt %>&close_dt=<%=close_dt %>"  width='100%' height='100' SCROLLING='AUTO' frameborder='0'></iframe>     
              </td>
         </tr>
        <tr>
        	<td align="right"  style="padding:0 0 10px 0;"><!-- a href="#"><img src="/images/hrd_main_BTN10.gif" alt="" border="0"/></a>&nbsp;<a href="#"><img src="/images/hrd_main_BTN11.gif" alt="" border="0"/></a --></td>
        </tr>
    </table>
  
    <!-- footer area -->
		<jsp:include page="common/footer.jsp"></jsp:include> 
	</td>
  </tr>
</table>
</body>
</html>
